<template>
  <div>
     <form action="">
      <h3>水果店收银系统</h3>
      <h4>苹果{{price}}/斤，折扣{{count}}折</h4>
      请输入要购买的斤数<input type="text" v-model="sum"><br>
      <button @click.prevent="add(sum)">结账</button>
      <h4> 结账单：总价：{{total}}元 折后价：{{counts}}元 省了：{{more}}元</h4>
     </form>
   </div>
</template>
 
<script>
export default {
  components: {},
  props: {},
  data() {
    return {
      price: 5,
      count: 8,
      total: 0,
      counts: 0,
      more: 0
    };
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    add(sum){
      this.total = sum * this.price
      this.counts = this.total-this.total/this.count
      this.more = this.total-this.counts
    }
  }
};
</script>

<style scoped>
     
</style>